import React, { Component } from 'react'
import Child from './components/Child'

// is方法,比较两个immutable对象的值是否相同
// import { fromJS, is } from 'immutable'
// let s1 = fromJS([1])
// let s2 = fromJS([1])
// console.log(s1 == s2) // false
// console.log(is(s1, s2)) // true

class App extends Component {
  
  state = {
    // num:100,
    num: { value: 100 },
    age: 200
  }


  render() {
    return (
      <div>
        <h3>App应用 -- {this.state.age}</h3>
        <button
          onClick={() => {
            this.setState(state => ({ age: state.age + 1 }))
          }}
        >
          ++++ age ++++
        </button>
        <hr />
        <Child num={this.state.num} />
        <button
          onClick={() => {
            this.setState(state => ({num:{ value: 100 }}))
          }}
        >
          ++++ num ++++
        </button>
      </div>
    )
  }
}

export default App
